﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
火狐下 模拟 点击超链接 完美方案
    <script type="text/javascript">
        function f() {
            var a = document.getElementById("btn1");
            var evt = document.createEvent("MouseEvents");
            evt.initEvent("click", true, true);
            if (a.dispatchEvent(evt) == true) {
                window.location = a.href;
            }
        }
        function clickev(event) {
            alert(event);
        }


    </script>

    <input value="click here" type="button" onclick="f()" />
    <a id="btn1" href="javascript:alert('成功！')" onclick="clickev(event);">结果一样么？</a>
</body>
</html>
